package com.fbinggun.fattribute.effect;

import com.fbinggun.fattribute.FAttributePlugin;
import com.fbinggun.fattribute.data.EntityData;
import com.fbinggun.fattribute.status.Modifier;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

public class AttributeUpEffect extends IEffect{
    List<String> list = new ArrayList<>();
    int tick;
    Modifier modifier;
    /**
     * 创建效果
     *
     * @param duration     持续时间
     * @param modification 增幅系数
     * @param source       给与效果的实体（发起源）
     * @param id 效果id
     */
    public AttributeUpEffect(int duration, double modification, EntityData source,List<String> attribute,String id) {
        super(duration, modification, source);
        modifier= new Modifier("AttributeUpEffect_"+id , FAttributePlugin.plugin,attribute);
        tick=duration;
    }
    public AttributeUpEffect(int duration, double modification, EntityData source,Modifier modifier) {
        super(duration, modification, source);
        this.modifier= modifier;
        tick=duration;
    }

    @Override
    public void tick(EntityData entityData) {
        entityData.addModifier(modifier);
        tick--;
        if(tick==1){
            entityData.getStatusMap().removeModifier(modifier.getKey());
        }
    }
}
